<script setup lang="ts">
import useUserStore from "@/store/modules/user.ts";
import { getTimeRange } from "@/utils/time.ts";
import { onMounted, ref } from "vue";
import SvgIcon from "@/components/SvgIcon/index.vue";

let userStore = useUserStore();

let timeStr = ref<String>("");

onMounted(() => {
  timeStr.value = getTimeRange(new Date()) + "好";
});

defineOptions({
  name: "Home",
});
</script>

<template>
  <el-card>
    <div class="box-card">
      <el-avatar shape="circle" class="img" :src="userStore.avatar" alt="">
      </el-avatar>
      <div>
        <h3>{{ userStore.username }},{{ timeStr }}</h3>
        <p>小周甄选平台欢迎您！</p>
      </div>
    </div>
  </el-card>

  <svg-icon name="home" class="icon" width="500px" height="500px"></svg-icon>
</template>

<style scoped lang="scss">
.box-card {
  display: flex;
  align-items: center;
  .img {
    margin-bottom: 10px;
    margin-right: 20px;
    height: 160px;
    width: 160px;
  }
  h3 {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 50px;
  }

  p {
    font-size: 16px;
    color: #999;
  }
}

.icon {
  display: flex;
  justify-content: center;
}
</style>
